   var _customIdeParentPath = "../ide/";
   var syncIdeFunc;
   require([
      	  _customIdeParentPath+"lib/codemirror", 
    	  _customIdeParentPath+"mode/htmlmixed/htmlmixed.js",
    	  _customIdeParentPath+"addon/display/fullscreen.js", 
    	  _customIdeParentPath+"addon/fold/foldcode.js",
    	  _customIdeParentPath+"addon/fold/foldgutter.js",
    	  _customIdeParentPath+"addon/fold/xml-fold.js",
    	  _customIdeParentPath+"addon/fold/brace-fold.js",
    	  _customIdeParentPath+"mode/xml/xml.js",
    	  _customIdeParentPath+"formatHtml/beautifyHtml.js",
    	  _customIdeParentPath+"formatHtml/htmlformat.js",
    	  _customIdeParentPath+"formatHtml/jsformat.js",
    	  _customIdeParentPath+"addon/hint/show-hint.js", 
    	  _customIdeParentPath+"addon/hint/css-hint.js",
    	  _customIdeParentPath+"addon/hint/javascript-hint.js",
    	  _customIdeParentPath+"addon/hint/xml-hint.js",
    	  _customIdeParentPath+"addon/hint/html-hint.js"
    	],function(CodeMirror) {
	  var doc = CodeMirror.fromTextArea(document.getElementById("code"), {			    
		lineNumbers: true,
		mode: "htmlmixed",
		theme: "the-matrix",
		autoMatchParens:true,
		foldGutter: true,
		gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
		extraKeys: {
			"F11": function(cm) {
			  cm.setOption("fullScreen", !cm.getOption("fullScreen"));
			},
			"Esc": function(cm) {
			  if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
			},
			"Alt-/": "autocomplete"
		}
	  });
	  doc.setSize('100%', '100%');
	  doc.foldCode(CodeMirror.Pos(0, 0));
	  doc.foldCode(CodeMirror.Pos(21, 0));
	  
	  
	  $("#insertValueListener").click(function(){
		  	doc.setValue('');
			var tag = $("#codeContainer").val();
			doc.replaceSelection(tag);
	  })
	  
	  
	  $("#formatListener").click(function(){			       
			var html = do_js_beautify("formatListener", doc.getValue());							
			doc.setValue(html);
	  })

	  syncIdeFunc = function(){
		  var content = doc.getValue();
		  $("#code").val(content);
	  }
	  
	});	
   
   